$(".formvalidate").validate({
    errorElement: "span",
    errorClass: "errormsg",
    success:"valid",
    submitHandler: function(form)
    {
        $(form).ajaxSubmit({
            dataType: 'json',
            type:'post',
            success: function (data) {
                if(data.status==true){
                    ajax_close(data);
                    window.location.reload();
                }else{
                    ajax_close(data);
                }
                if(data.url&&data.url!=undefined){
                    setTimeout(function(){
                        window.location.href=data.url;
                    },1000);
                }
                if(data.status==true&&data.url==undefined){
                    setTimeout(function(){
                        window.location.href=data.url;
                    },1000);
                }
            },
            error: function(XmlHttpRequest, textStatus, errorThrown){
                ajax_close();
            }
        });
    }
});
/**
 * ajax提示时执行信息
 */
function ajax_close(data){
    var timer;
    var $icon = 'error';
    if(data.status=='1')$icon = 'succeed';
    $.dialog({
        content: data.info,
        icon:$icon,
        init: function () {
            var that = this, i = 1;
            var fn = function () {
                that.title(i + '秒后关闭');
                !i && that.close();
                i --;
            };
            timer = setInterval(fn, 1000);
            fn();
        },
        close: function () {
            clearInterval(timer);
        }
    }).show();
}
var diy_height="500";